package com.czy.movie.controller;

import com.czy.movie.pojo.User;
import com.czy.movie.repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author czy
 * @create 2018-04-15 22:16
 **/
@RestController
public class MovieController
{
	@Autowired
	private UserRepository userRepository;

	@GetMapping("/{id}")
	public User findById(@PathVariable Integer id)
	{
		return userRepository.findById(id).get();
	}

	@GetMapping("/all")
	public List<User> findAll()
	{
		return userRepository.findAll();
	}
}
